imcontext: Code cleanup
authorMatthias Clasen <mclasen@redhat.com>
Mon, 1 Feb 2021 17:08:38 +0000 (12:08 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 1 Feb 2021 17:10:05 +0000 (12:10 -0500)
Use g_clear_pointer instead of opencoding it in
multiple places.

gtk/gtkimcontextsimple.c

index 76afa8c1eecd4a164a002055ad049e2ee248ea39..093145c307c9f78c8816f1d768dd12c84892361b 100644 (file)
@@ -174,8 +174,7 @@ gtk_im_context_simple_init_compose_table (void)
       g_free (path);
       return;
     }
-  g_free (path);
-  path = NULL;
+  g_clear_pointer (&path, g_free);
 
   home = g_get_home_dir ();
   if (home == NULL)
@@ -190,8 +189,7 @@ gtk_im_context_simple_init_compose_table (void)
       g_free (path);
       return;
     }
-  g_free (path);
-  path = NULL;
+  g_clear_pointer (&path, g_free);
 
   locale = g_getenv ("LC_CTYPE");
   if (locale == NULL)
@@ -224,8 +222,7 @@ gtk_im_context_simple_init_compose_table (void)
 
       if (g_file_test (path, G_FILE_TEST_EXISTS))
         break;
-      g_free (path);
-      path = NULL;
+      g_clear_pointer (&path, g_free);
     }
 
   g_free (x11_compose_file_dir);
@@ -237,8 +234,7 @@ gtk_im_context_simple_init_compose_table (void)
       global_tables = gtk_compose_table_list_add_file (global_tables, path);
       G_UNLOCK (global_tables);
     }
-  g_free (path);
-  path = NULL;
+  g_clear_pointer (&path, g_free);
 }
 
 static void